//
//  KZMessageOfSystemCell.swift
//  BoyeStore
//
//  Created by 朱凯 on 2018/6/27.
//  Copyright © 2018年 itboye. All rights reserved.
//

import UIKit

class KZMessageOfSystemCell: UITableViewCell {
    
    let bgView = UIView()
    let titleLabel = UILabel()
    let contentLabel = UILabel()
    let timeLabel = UILabel()
    
    override init(style: UITableViewCellStyle, reuseIdentifier: String?) {
        super.init(style: style, reuseIdentifier: reuseIdentifier)
        self.selectionStyle = .none
        self.backgroundColor = .clear
        setupUI()
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
}

extension KZMessageOfSystemCell {
    
    func setupUI() {
        
        contentView.addSubview(bgView)
        bgView.backgroundColor = UIColor.white
        bgView.layer.cornerRadius = 8
        bgView.layer.masksToBounds = true
        bgView.snp.makeConstraints { (m) in
            m.left.equalTo(10)
            m.top.equalTo(0)
            m.right.equalTo(-10)
            
            m.bottom.equalTo(0)
        }
        
        titleLabel.numberOfLines = 1
        titleLabel.textColor = UIColor.lightGray
        titleLabel.textAlignment = .left
        titleLabel.text = "验收提醒"
        titleLabel.font = UIFont.systemFont(ofSize: 13)
        bgView.addSubview(titleLabel)
        titleLabel.snp.makeConstraints { (m) in
            m.left.equalTo(10)
            m.height.equalTo(40)
            m.top.equalTo(0)
        }
        
        timeLabel.textColor = UIColor.lightGray
        timeLabel.textAlignment = .right
        timeLabel.text = "2018/06/21 18:02"
        timeLabel.font = UIFont.systemFont(ofSize: 12)
        bgView.addSubview(timeLabel)
        timeLabel.snp.makeConstraints { (m) in
            m.right.equalTo(-10)
            m.top.height.equalTo(titleLabel)
            m.left.greaterThanOrEqualTo(titleLabel.snp.right).offset(10)
        }
        
        let line = UIView()
        line.backgroundColor = kLineColor
        bgView.addSubview(line)
        line.snp.makeConstraints { (m) in
            m.top.equalTo(titleLabel.snp.bottom)
            m.left.right.equalTo(0)
            m.height.equalTo(0.5)
            

        }
        
        
        
        contentLabel.numberOfLines = 0
        contentLabel.textColor = UIColor.black
        contentLabel.textAlignment = .left
        contentLabel.text = "亲，您的包裹已经派件了，收货时请检查外包装是否完整，如有破损请及时与我们联系"
        contentLabel.font = UIFont.systemFont(ofSize: 12)
        bgView.addSubview(contentLabel)
        contentLabel.snp.makeConstraints { (m) in
            m.top.equalTo(titleLabel.snp.bottom).offset(15)
            m.left.equalTo(titleLabel)
            m.right.equalTo(timeLabel)

            m.bottom.equalTo(-15)
        }
        
      
        
       
    }
}
